<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>쿠폰 플래이</title>
</head>
<p></p>
<form id="form1" name="form1" method="post" action="/admin/provider/form.html">
	<fieldset>
		<table summary="제공자상세보기">
			<tbody>
			<tr>
				<th scope="row" align="left">코드</th>
				<td>${provider.code}</td>
			</tr>
				<tr>
					<th scope="row" align="left">이름</th>
					<td>${provider.name}</td>
				</tr>
				
				<tr>
					<th scope="row" align="left">홈페이지</th>
					<td>${provider.homepage}</td>				
				</tr>
				<tr>
					<th scope="row" align="left">전화번호</th>
					<td>${provider.telephone}</td>				
				</tr>
				<tr>
					<th scope="row" align="left">이메일</th>
					<td>${provider.email}</td>	
				</tr>
			</tbody>
		</table>
	</fieldset>
</form> 
	<div>
		<button onclick="update(${provider.code})" style="font-size:12px;font-family: Malgun Gothic,Gulim;padding:0;margin:0">수정하기</button>
		<button onclick="deleteData(${provider.code})" style="font-size:12px;font-family: Malgun Gothic,Gulim;padding:0;margin:0">삭제하기</button>
		<button onclick="goList();" style="font-size:12px;font-family: Malgun Gothic,Gulim;padding:0;margin:0">목록</button>
	</div>	
</body>
<script type="text/javascript">
	var form1 = document.form1;	

	var update = function(code){
		form1.action ="/admin/provider/form.html?code=" + code;
		form1.submit();
		//location.href = "update.html"; 
		//location.replace("update.html");
	}
	
	var deleteData = function(code){
		var x = confirm("삭제하시겠습니까?");
		
		if(x == true){
		form1.action ="/admin/provider/delete.html?code=" + code;
		form1.submit();
		}
	}
		
	var goList = function(){
			location.href = "list.html"; 
			location.replace("list.html"); 
	}
</script>